package UnOfficeDeTourisme;

/**
 * Interface definition : SGCartes
 * 
 * @author OpenORB Compiler
 */
public abstract class SGCartesPOA extends org.omg.PortableServer.Servant
        implements SGCartesOperations, org.omg.CORBA.portable.InvokeHandler
{
    public SGCartes _this()
    {
        return SGCartesHelper.narrow(_this_object());
    }

    public SGCartes _this(org.omg.CORBA.ORB orb)
    {
        return SGCartesHelper.narrow(_this_object(orb));
    }

    private static String [] _ids_list =
    {
        "IDL:UnOfficeDeTourisme/SGCartes:1.0"
    };

    public String[] _all_interfaces(org.omg.PortableServer.POA poa, byte [] objectId)
    {
        return _ids_list;
    }

    public final org.omg.CORBA.portable.OutputStream _invoke(final String opName,
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler)
    {

        if (opName.equals("_get_listeDesCartes")) {
                return _invoke__get_listeDesCartes(_is, handler);
        } else if (opName.equals("creerCarte")) {
                return _invoke_creerCarte(_is, handler);
        } else if (opName.equals("getEntrees")) {
                return _invoke_getEntrees(_is, handler);
        } else {
            throw new org.omg.CORBA.BAD_OPERATION(opName);
        }
    }

    // helper methods
    private org.omg.CORBA.portable.OutputStream _invoke__get_listeDesCartes(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        UnOfficeDeTourisme.Carte[] arg = listeDesCartes();
        _output = handler.createReply();
        UnOfficeDeTourisme.listeCartesHelper.write(_output,arg);
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_creerCarte(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        UnOfficeDeTourisme.Prestation arg0_in = UnOfficeDeTourisme.PrestationHelper.read(_is);

        creerCarte(arg0_in);

        _output = handler.createReply();

        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_getEntrees(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        int arg0_in = _is.read_long();

        try
        {
            UnOfficeDeTourisme.Entree[] _arg_result = getEntrees(arg0_in);

            _output = handler.createReply();
            UnOfficeDeTourisme.listeEntreesHelper.write(_output,_arg_result);

        }
        catch (UnOfficeDeTourisme.ListeVideException _exception)
        {
            _output = handler.createExceptionReply();
            UnOfficeDeTourisme.ListeVideExceptionHelper.write(_output,_exception);
        }
        return _output;
    }

}
